<template>
  <div id="child" class="room-frame com-flex-c com-center-c" v-if="!changeA && show">
    <div class="title">告警信息</div>
    <div class="room-text com-flex-c">
      <div class="item">
        <div class="label">告警名称：</div>
        <div class="value">{{ dataList.signalName ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">告警描述：</div>
        <div class="value">{{ dataList.alarmDesc ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">告警状态：</div>
        <div class="value">{{ dataList.alarmStatus ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">告警等级：</div>
        <div class="value">{{ dataList.alarmLevel ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">流水号：</div>
        <div class="value">{{ dataList.alarmNo ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">触发时间：</div>
        <div class="value">{{ dataList.alarmTime ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">结束时间：</div>
        <div class="value">{{ dataList.endTime ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">结束时间：</div>
        <div class="value">{{ dataList.endTime ?? "--" }}</div>
      </div>
      <div class="item">
        <div class="label">持续时间：</div>
        <div class="value">{{ dataList.sustainCount ?? "--" }}</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { onMounted, ref, watch } from "vue";
import Bus from "@/utils/bus.js";

const dataList = ref([]);
const show = ref(false);
let change = false;
onMounted(() => {
  Bus.on("GjCard", (data) => {
    dataList.value = data.item;
    show.value = data.showCart;
    console.log(dataList.value, show.value);
    change = true;
  });
  Bus.on("Cardchild2", (e) => {
    changeA.value = e;
    if (changeA.value) {
      show.value = false;
    }
  });
});
const changeA = ref(true);
const changeB = ref(true);
const canShow = (a, b) => {
  if (a && b) {
    show.value = false;
  }
};
// document.addEventListener("click", function (event) {
//   var target = event.target; // 获取触发点击事件的元素
//   var div1 = document.getElementById("child"); // 获取div元素
//   // 检查点击的元素是否为div以外的其他地方
//   if (div1?.contains(target)) {
//     // 如果是，执行需要的操作
//     changeB.value = false;
//     console.log("xxx");
//   } else {
//     changeB.value = true;
//   }
// });
</script>

<style lang="scss" scoped>
.room-frame {
  width: 100%;
  height: 70%;
  background: url("/imgs/7.png");
  background-size: 100% 100%;
  position: relative;

  .all-text {
    margin: 2% 0;
  }

  .title {
    display: flex;
    align-items: center;
    width: 92%;
    height: 9%;
    font-size: 30px;
    color: #f3f8fd;
    line-height: 28px;
  }

  .room-text {
    flex: 1;
    width: 92%;
    margin-bottom: 2%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;

    .info-label {
      font-size: 26px;
      margin-left: 4%;
      color: #e4f0fe;
    }

    .item {
      color: #86a5cc;
      display: flex;
      margin-left: 8%;
      font-style: italic;
      font-size: 26px;
      .value {
        color: #e4f0fe;
      }
    }
  }
}
</style>
